package com.yequan.work;

import com.alibaba.fastjson.JSON;

import java.util.HashMap;

/**
 * @author yequan
 * @date 2021/04/23 17:27
 **/
public class InterCityMapDemo {

    public static void main(String[] args) {
        String interFeeRule = "{\"interCitySuggestFeeMap\":{1:{\"base_fee\":15,\"base_km\":\"0\",\"insurance_fee\":5,\"inter_rules\":[{\"max_km\":30,\"min_km\":0,\"fee\":1.1},{\"max_km\":150,\"min_km\":30,\"fee\":0.4},{\"max_km\":\"\",\"min_km\":150,\"fee\":0.4}]},2:{\"base_fee\":15,\"base_km\":\"0\",\"insurance_fee\":5,\"inter_rules\":[{\"max_km\":30,\"min_km\":0,\"fee\":1.1},{\"max_km\":150,\"min_km\":30,\"fee\":0.8},{\"max_km\":\"\",\"min_km\":150,\"fee\":0.7}]},3:{\"base_fee\":20,\"base_km\":\"0\",\"insurance_fee\":5,\"inter_rules\":[{\"max_km\":30,\"min_km\":0,\"fee\":1.2},{\"max_km\":150,\"min_km\":30,\"fee\":1.1},{\"max_km\":\"\",\"min_km\":150,\"fee\":1}]},4:{\"base_fee\":20,\"base_km\":\"0\",\"insurance_fee\":5,\"inter_rules\":[{\"max_km\":30,\"min_km\":0,\"fee\":1.6},{\"max_km\":150,\"min_km\":30,\"fee\":1.5},{\"max_km\":\"\",\"min_km\":150,\"fee\":1.2}]}}}";
        InterCitySuggestFeeMap interCitySuggestFeeMap = JSON.parseObject(interFeeRule, InterCitySuggestFeeMap.class);
        HashMap<Integer, CarpoolInterFeeRule> interCitySuggestFeeMap1 = interCitySuggestFeeMap.getInterCitySuggestFeeMap();
        CarpoolInterFeeRule carpoolInterFeeRule = interCitySuggestFeeMap1.get(1);
        System.out.println(JsonMapper.toJson(carpoolInterFeeRule));
    }

}
